package com.ruoyi.app.converter;

import com.ruoyi.app.domain.labor.LaborInfo;
import com.ruoyi.app.domain.labor.LaborInfoDetail;
import com.ruoyi.app.domain.register.DemanderRegister;
import com.ruoyi.app.domain.register.LaborRegister;
import com.ruoyi.app.domain.user.LoginUserInfo;
import com.ruoyi.app.domain.user.add.UserInfoAdd;
import com.ruoyi.app.domain.user.add.UserInfoView;
import com.ruoyi.service.user.entity.UserEntity;
import com.ruoyi.service.user.model.UserInfoModel;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

/**
 * <p>
 * 作用： 用户信息主演换器
 * </p>
 *
 * @author zhanglianbao
 * @since 2025-02-05 16:19
 */
@Mapper(uses = {})
public interface UserConverter {

  UserConverter INSTANCE = Mappers.getMapper(UserConverter.class);
  LaborExtConverter laborExtConverter = LaborExtConverter.INSTANCE;

  /**
   * 实体转换成登录信息
   */
  @Mappings({})
  LoginUserInfo toUserLogin(UserEntity userEntity);

  /**
   * 实体转换成登录信息
   */
  @Mappings({})
  LoginUserInfo toUserLogin(UserInfoModel userInfoModel);

  /**
   * 实体传唤成模型类
   */
  @Mappings({})
  UserInfoModel toUserModel(UserEntity userEntity);

  /**
   * 模型类转换成实体类
   */
  @Mappings({})
  UserEntity toUserEntity(LaborRegister laborRegister);

  @Mappings({
      @Mapping(target = "phone", source = "linkPhone"),
      @Mapping(target = "name", source = "linkUser"),
      @Mapping(target = "nickName", source = "linkUser"),
      @Mapping(target = "idNumber", source = "linkIdCard")
  })
  UserEntity toUserEntity(DemanderRegister demanderRegister);

  @Mappings({})
  LaborInfo toLaborInfo(UserEntity userEntity);

  @Mappings({})
  LaborInfoDetail toLaborInfoDetail(UserEntity userEntity);

  /**
   * 模型类转换成实体类
   */
  @Mappings({})
  UserEntity toUserEntity(UserInfoAdd userInfoAdd);

  /**
   * 模型类转换成视图类
   */
  @Mappings({})
  UserInfoView toUserInfoView(UserEntity userEntity);
}
